<?php
include './../../common.inc.php';

$area   = PCache::read('area.php');
$result = array();

$provience = __($area)->filter(function($item){
	return $item['parentid']==3421;
});
$result = array();
foreach($provience as $pro) {
	if (in_array($pro['areaname'], array('北京', '天津', '香港', '澳门', '重庆', '上海'))) {
		$result[] = array($pro['areaname'], '');
	} else {
		$citys = __($area)->filter(function($item) use($pro){
			return $item['parentid'] == $pro['areaid'];
		});
		foreach($citys as $city) {
			$city['areaname'] = str_replace(array('市', '自治州', '自治县', '藏族', '地区', '回族', '布依族', '苗族', '侗族', '群岛', '黎族', '林区', '蒙古族','彝族', '哈尼族', '壮族', '傣族', '景颇族', '傈僳族', '土家族', '土家族', '朝鲜族'), '', $city['areaname']);
			$result[] = array($pro['areaname'], $city['areaname']);
		}
	}
}

foreach ($result as $item) {
	$place = $item[1] ? $item[0].'_'.$item[1] : $item[0];
	echo "$item[0], $item[1],".Str::text2py($item[0], 0, true);
	if ($item[1]) {
		echo '_'.Str::text2py($item[1])."\n";
	} else {
		echo PHP_EOL;
	}
}